<template>
  <h1>双向绑定指令</h1>
  {{ info }}
  <input type="text" :value="info">
  <hr><input type="text" v-model="info">

  <hr>

  <h3>登陆界面</h3>
  <input type="text" placeholder="请输入用户名" v-model="user.username">
  <input type="password" placeholder="请输入密码" v-model="user.password">
  <br>
  性别:
  <input type="radio" name="gender" v-model="user.gender" value="M">男
  <input type="radio" name="gender" v-model="user.gender" value="W">女
  <br>
  <button @click="login()">点击登录</button>
</template>

<script setup>
import {ref} from "vue";

const info = ref('双向绑定测试文段');

const user = ref({username: '张三', password: '123456', gender: 'M'})
const login = () => {
  console.log(user.value);
  console.log(user.value.username);
  console.log(user.value.password);
  console.log(user.value.gender);
}
</script>

<style scoped>

</style>